<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:composition>



        <p:dialog id="dlgMovimentacaoCofre"
                  header="MOVIMENTAÇÃO DE COFRE"
                  widgetVar="dialogMovimentacaoCofre" 
                  modal="true" 
                  resizable="false" 
                  appendTo="@(body)">

            <h:form id="formMovimentacaoCofre" >

                <h:panelGrid id="displayMovimentacaoCofre"
                             style="width: 100%" >

                    <h:panelGroup>

                        <h:outputText value="Cofre" /><br/>
                        <p:selectOneMenu value="#{movimentacaoCofreBean.selected.cofre}" 
                                         style="width: 100%"
                                         required="true"
                                         requiredMessage="O campo cofre é requerido">

                            <f:selectItem itemLabel="Selecione" />
                            <f:selectItems value="#{movimentacaoCofreBean.cofres}" />
                            <f:converter converterId="simpleEntityConverter" />

                        </p:selectOneMenu>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="Tipo de Movimentação" /><br/>
                        <p:selectOneMenu value="#{movimentacaoCofreBean.selected.tipoMovimentacao}" 
                                         style="width: 100%"
                                         required="true"
                                         requiredMessage="O campo tipo de movimentação é requerido">

                            <f:selectItem itemLabel="Selecione" />
                            <f:selectItems value="#{movimentacaoCofreBean.tiposMovimentacoes}" />

                        </p:selectOneMenu>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="Valor" /><br/>
                        <pe:inputNumber value="#{movimentacaoCofreBean.selected.valor}" 
                                        style="width: 97%" 
                                        required="true"
                                        requiredMessage="O campo valor é requerido"
                                        decimalSeparator=","
                                        thousandSeparator="."
                                        symbol="R$"/>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="Data" /><br/>
                        <p:inputMask value="#{movimentacaoCofreBean.selected.dataOcorrencia}" 
                                     style="width: 97%" 
                                     mask="99/99/9999" 
                                     required="true"
                                     requiredMessage="O campo data é requerido">

                            <f:convertDateTime timeZone="America/Sao_Paulo"/>

                        </p:inputMask><br/>

                    </h:panelGroup>

                    <h:panelGroup>

                        <h:outputText value="Hora/Minutos" /><br/>
                        <p:inputMask value="#{movimentacaoCofreBean.selected.hora}" 
                                     style="width: 97%" 
                                     mask="99:99" 
                                     required="true"
                                     requiredMessage="O campo hora é requerido"/><br/>

                    </h:panelGroup>

                </h:panelGrid>

                <hr/>

                <p:commandButton value="Gravar" 
                                 actionListener="#{movimentacaoCofreBean.save(event)}"
                                 update=":formMovimentacoesCofres:dtMovimentacoesCofres, :growl, displayMovimentacaoCofre"
                                 oncomplete="handleSubmit(xhr,status,args,dialogMovimentacaoCofre);"
                                 />

            </h:form>

        </p:dialog>

    </ui:composition>

</html>


